package chamber.three;

import chamber.three.guice.ThreeModule;
import com.google.inject.Inject;
import common.Program;
import common.ProgramFactory;

import java.util.concurrent.TimeUnit;

/**
 * Created by gcortes on 1/30/14.
 */
public class ChamberThree implements Program {
    private Configuration configuration;

    @Inject
    public ChamberThree(Configuration configuration) {
        this.configuration = configuration;
    }

    public static void main(String[] args) {
        Program program = ProgramFactory.create(ChamberThree.class, new ThreeModule());
        program.execute();
    }

    @Override
    public void execute() {
        for (int i=0; i < 5; ++i) {
            System.out.println(configuration.getName());
            try {
                Thread.sleep(TimeUnit.SECONDS.toMillis(3));
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
